<?php
class JsrtHelper extends AppHelper 
{
	
	var $helpers=array('Javascript');

	function remoteTimer($options = null) 
	{
	    if(!$options)
		{
			return;
		}
		$remote = 'remoteTimer'.rand(10,10000);
			
		return $this->Javascript->codeBlock('var '.$remote.' = function() {$.ajax({url: \''.Router::url($options['url']).'\',type: \'get\', dataType : \'html\', success : function(html) { $(\'#'.$options['update'].'\').html(html); setTimeout('.$remote.', 1000 * '.$options['frequency'].');}});}; '.$remote.'();');
	}
}